
import socket
import json

sk = socket.socket()
sk.bind(('127.0.0.1', 9000))
sk.listen()

conn, _ = sk.accept()

str_dic = conn.recv(1024).decode('utf-8')
file_name_dic = json.loads(str_dic)
content = conn.recv(1024)
with open(file_name_dic['file_name'], 'wb') as f:
    f.write(content)
conn.close()
sk.close()
